use gloo::net::{
    http::{Headers, Request, RequestBuilder},
    Error,
};

struct Ajax {
    base_url: String,
    request: Request,
}

impl Ajax {
    fn new(mut self: Self, base_url: String) {
        // self.base_url = base_url;

        // let request: RequestBuilder = RequestBuilder::new(&self.base_url);

        // let headers = Headers::new();
        // // 请求头数据
        // headers.append("token", "12345");
        // request.headers(headers);
    }

    // 请求
    pub async fn request(url: &str) {
        let res = Request::get(url).send().await.unwrap();

        if res.status() == 200 {}
    }
}
